import fetch from 'common/src/utils/fetch';


/**
 *获取排考开关列表
 */
function getListPage(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/getListPage',
    method: 'post',
    data
  })
}

/**
 *排考开关设置
 */
function setSwitchSetting(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/set',
    method: 'post',
    data
  })
}

/**
 *排考开关新增
 */
function addSwitchSetting(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/add',
    method: 'post',
    data
  })
}

/**
 *排考开关修改
 */
function editSwitchSetting(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/edit',
    method: 'post',
    data
  })
}

/**
 *排考开关删除
 */
function deleteSwitchSetting(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/delete',
    method: 'delete',
    data
  })
}

/**
 *获取排考学期开关
 */
export function getExamCalendar(data , switchType) {
  if (switchType !== 6) {
    switchType = null;
  }
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/getExamCalendar?examType='+ data + '&switchType=' + switchType,
    method: 'post',
    data
  })
}

/**
 *设置排考学期开关
 */
function setExamCalendar(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/setExamCalendar',
    method: 'post',
    data
  })
}

/**
 *获取默认系统考试类型
 */
export function getDefaultType(data) {
  return fetch({
    url: '/api/electionservice/common/fxExamSwitch/getDefaultType',
    method: 'post',
    data
  })
}

export default {
  getListPage: getListPage,
  setSwitchSetting: setSwitchSetting,
  addSwitchSetting: addSwitchSetting,
  editSwitchSetting: editSwitchSetting,
  deleteSwitchSetting: deleteSwitchSetting,
  getExamCalendar: getExamCalendar,
  setExamCalendar: setExamCalendar,
  getDefaultType: getDefaultType
};
